/*
 * @Author: linZeJian
 * @Date: 2022-01-24 14:54:15
 * @LastEditors: linZeJian
 * @LastEditTime: 2022-06-16 14:27:24
 * @Description: 
 */
import {
  fileURLToPath
} from 'url'

import {
  defineConfig
} from 'vite'
import legacy from '@vitejs/plugin-legacy'
import {
  createVuePlugin as vue2
} from 'vite-plugin-vue2'
import scriptSetup from 'unplugin-vue2-script-setup/vite'

// https://vitejs.dev/config/
export default defineConfig({
  base: "/basePath",
  plugins: [
    vue2({
      jsx: true
    }),
    scriptSetup(),
    legacy({
      targets: ['ie >= 11'],
      additionalLegacyPolyfills: ['regenerator-runtime/runtime']
    })
  ],
  server: {
    host: '0.0.0.0',
    port: 3012,
    proxy: {
      // 代理
      '/idaas': {
        target: `https://tobacco.oars.gzsunrun.cn/idaas`,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/idaas/, '')
      },
    },
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src',
        import.meta.url))
    }
  }
})